#!/bin/bash
. /etc/profile

filename="Tcp.php"

hms=`date '+%H%M' `
count=`ps -fe |grep "$filename" | grep -v "grep" | wc -l`

echo "\n TCP COUNT:${count}";

if [ $count -lt 1 ]; then

ps -eaf |grep "$filename" | grep -v "grep"| awk '{print $2}'|xargs kill -9

sleep 2

/usr/bin/php  /home/swoole/zhy/swooleSocket/Tcp.php 

/usr/bin/php  /home/swoole/screen/swooleSocket/Tcp.php 

fi



if [ $hms=='0000' ]; then

echo "" > /home/swoole/screen/swooleSocket/cesshi.log
echo "" > /home/swoole/zhy/swooleSocket/cesshi.log

fi


countRedis=`ps -ef | grep "redis-server" | grep -v "grep" | wc -l`

echo "\nREDIS COUNT :${countRedis}";

if [ $countRedis -lt 1 ]; then

#ps -eaf | grep "redis-server" | grep -v "grep" | awk '{print $2}'|xargs kill -9
redis-cli shutdown

sleep 2

redis-server &

fi

